package com.nanhai.buddhist.college.module.study.dal.mysql.teacherevaluation;

import java.util.*;

import com.nanhai.buddhist.college.framework.common.pojo.PageResult;
import com.nanhai.buddhist.college.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.nanhai.buddhist.college.framework.mybatis.core.mapper.BaseMapperX;
import com.nanhai.buddhist.college.module.study.dal.dataobject.teacherevaluation.TeacherEvaluationDO;
import org.apache.ibatis.annotations.Mapper;
import com.nanhai.buddhist.college.module.study.controller.admin.teacherevaluation.vo.*;

/**
 * 教师评价 Mapper
 *
 * @author 南海佛学院
 */
@Mapper
public interface TeacherEvaluationMapper extends BaseMapperX<TeacherEvaluationDO> {

    default PageResult<TeacherEvaluationDO> selectPage(TeacherEvaluationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TeacherEvaluationDO>()
                .eqIfPresent(TeacherEvaluationDO::getStudentId, reqVO.getStudentId())
                .likeIfPresent(TeacherEvaluationDO::getStudentName, reqVO.getStudentName())
                .likeIfPresent(TeacherEvaluationDO::getPhone, reqVO.getPhone())
                .eqIfPresent(TeacherEvaluationDO::getTeacherId, reqVO.getTeacherId())
                .likeIfPresent(TeacherEvaluationDO::getTeacherName, reqVO.getTeacherName())
                .likeIfPresent(TeacherEvaluationDO::getEvaluationText, reqVO.getEvaluationText())
                .likeIfPresent(TeacherEvaluationDO::getCollegeName, reqVO.getCollegeName())
                .eqIfPresent(TeacherEvaluationDO::getCollegeId, reqVO.getCollegeId())
                .likeIfPresent(TeacherEvaluationDO::getDepartmentName, reqVO.getDepartmentName())
                .eqIfPresent(TeacherEvaluationDO::getDepartmentId, reqVO.getDepartmentId())
                .likeIfPresent(TeacherEvaluationDO::getProfessionsName, reqVO.getProfessionsName())
                .eqIfPresent(TeacherEvaluationDO::getProfessionsId, reqVO.getProfessionsId())
                .likeIfPresent(TeacherEvaluationDO::getClasseName, reqVO.getClasseName())
                .eqIfPresent(TeacherEvaluationDO::getClasseId, reqVO.getClasseId())
                .eqIfPresent(TeacherEvaluationDO::getEvaluationItemId, reqVO.getEvaluationItemId())
                .likeIfPresent(TeacherEvaluationDO::getEvaluationItemName, reqVO.getEvaluationItemName())
                .eqIfPresent(TeacherEvaluationDO::getScoreItemId, reqVO.getScoreItemId())
                .likeIfPresent(TeacherEvaluationDO::getScoreItemName, reqVO.getScoreItemName())
                .likeIfPresent(TeacherEvaluationDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(TeacherEvaluationDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(TeacherEvaluationDO::getOrgId, reqVO.getOrgId())
                .orderByDesc(TeacherEvaluationDO::getId));
    }

    default List<TeacherEvaluationDO> selectList(TeacherEvaluationExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<TeacherEvaluationDO>()
                .eqIfPresent(TeacherEvaluationDO::getStudentId, reqVO.getStudentId())
                .likeIfPresent(TeacherEvaluationDO::getStudentName, reqVO.getStudentName())
                .likeIfPresent(TeacherEvaluationDO::getPhone, reqVO.getPhone())
                .eqIfPresent(TeacherEvaluationDO::getTeacherId, reqVO.getTeacherId())
                .likeIfPresent(TeacherEvaluationDO::getTeacherName, reqVO.getTeacherName())
                .likeIfPresent(TeacherEvaluationDO::getEvaluationText, reqVO.getEvaluationText())
                .likeIfPresent(TeacherEvaluationDO::getCollegeName, reqVO.getCollegeName())
                .eqIfPresent(TeacherEvaluationDO::getCollegeId, reqVO.getCollegeId())
                .likeIfPresent(TeacherEvaluationDO::getDepartmentName, reqVO.getDepartmentName())
                .eqIfPresent(TeacherEvaluationDO::getDepartmentId, reqVO.getDepartmentId())
                .likeIfPresent(TeacherEvaluationDO::getProfessionsName, reqVO.getProfessionsName())
                .eqIfPresent(TeacherEvaluationDO::getProfessionsId, reqVO.getProfessionsId())
                .likeIfPresent(TeacherEvaluationDO::getClasseName, reqVO.getClasseName())
                .eqIfPresent(TeacherEvaluationDO::getClasseId, reqVO.getClasseId())
                .eqIfPresent(TeacherEvaluationDO::getEvaluationItemId, reqVO.getEvaluationItemId())
                .likeIfPresent(TeacherEvaluationDO::getEvaluationItemName, reqVO.getEvaluationItemName())
                .eqIfPresent(TeacherEvaluationDO::getScoreItemId, reqVO.getScoreItemId())
                .likeIfPresent(TeacherEvaluationDO::getScoreItemName, reqVO.getScoreItemName())
                .likeIfPresent(TeacherEvaluationDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(TeacherEvaluationDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(TeacherEvaluationDO::getOrgId, reqVO.getOrgId())
                .orderByDesc(TeacherEvaluationDO::getId));
    }



    default List<TeacherEvaluationDO> selectAllCollegesList() {
        return selectList(new LambdaQueryWrapperX<TeacherEvaluationDO>()
                .select(TeacherEvaluationDO::getCollegeId,TeacherEvaluationDO::getCollegeName)
                .isNotNull(TeacherEvaluationDO::getCollegeId)
                .groupBy(TeacherEvaluationDO::getCollegeId,TeacherEvaluationDO::getCollegeName));
    }


    default List<TeacherEvaluationDO> selectAllClassesList() {
        return selectList(new LambdaQueryWrapperX<TeacherEvaluationDO>()
                .select(TeacherEvaluationDO::getClasseId,TeacherEvaluationDO::getClasseName)
                .isNotNull(TeacherEvaluationDO::getClasseId)
                .groupBy(TeacherEvaluationDO::getClasseId,TeacherEvaluationDO::getClasseName));
    }



}
